<template>
	<view>
		
		<navigator url="../webview/webview">去web-view</navigator>
		<navigator url="../richeng/richeng">
			去日程
			</navigator>
		<view>
			{{ latitude }} -- {{ longitude }}
		</view>
		<map 
		:longitude="longitude" 
		:latitude="latitude" 
		:markers="markers"
		:scale="19"
		:min-scale="16"
		:polyline="polyline"
		style="width: 100%;height: 400px;"></map>
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				latitude:null,
				longitude:null,
				markers:[{
					latitude:null,
					longitude:null,
					iconPath:"../../static/weizhi.png"
				}],
				polyline:[{
					points:[{
						latitude: 31.841283,
						longitude: 117.301394
					},{
						latitude: 31.841273,
						longitude: 117.301494
					},{
						latitude: 31.861273,
						longitude: 117.601494
					}],
					color:"#ff0000"
				}]
			}
		},
		onLoad() {
			this.get()
		},
		methods: {
			get(){
				uni.getLocation({
					type:"gcj02",
					geocode:true,
					success:res => {
						this.latitude = res.latitude;
						this.longitude = res.longitude;
						this.markers[0].latitude = res.latitude;
						this.markers[0].longitude = res.longitude;
						console.log(res);	
					},
					fail:err => {
						console.log(err);
					}
				})
			}
		}
	}
</script>

<style>

</style>
